/* Includes ------------------------------------------------------------------*/
#include <main.h>

/* Private define-------------------------------------------------------------*/

/* Private variables----------------------------------------------------------*/
static void Timer0_Init();
/* Public variables-----------------------------------------------------------*/
Timer0_t idata Timer0 = 
{
	0,
	0,
	Timer0_Init
};
/* Private function prototypes------------------------------------------------*/

/*
* @name   Timer0_Init
* @brief  定时器0初始化
* @param  None
* @retval None   
*/
static void Timer0_Init()   //5毫秒@11.0592MHz
{
    AUXR &= 0x7F;		//定时器时钟12T模式
	TMOD &= 0xF0;		//设置定时器模式
	TL0 = 0x00;		//设置定时初值
	TH0 = 0xEE;		//设置定时初值
	TF0 = 0;		//清除TF0标志
	TR0 = 1;		//定时器0开始计时
}

/*
* @name   Timer0_isr
* @brief  定时器0中断处理函数（5ms进入一次）
* @param  None
* @retval None   
*/
void Timer0_isr() interrupt 1
{
	Timer0.msMCU_Timer0_Value++;
	if(Timer0.msMCU_Timer0_Value >= TIMER_1S)	//计时到1S
	{
		Timer0.msMCU_Timer0_Value = 0;
		Run_LED.Run_LED_Flip();						//运行指示灯翻转
	}
	Timer0.usDelay_Timer++;							//延时定时器，Uart1.protocol函数使用，WIFI模块使用
	STA_Machine.ucSTA_Machine_Scan_Timer++;			//状态机扫描定时器
	STA_Machine.usKEY2_Double_Click_Timer++;		//双击定时器
	STA_Machine.usKEY2_Press_Timer++;				//长按定时器
	ESP8266.TCP_Reconnect_Timer++;					//WIFI模块TCP服务器重连
}
/********************************************************
  End Of File
********************************************************/